import request from '@/utils/request'

const api_name = '/admin/acl/role'

export default {

    getPageList(page, limit, category, searchObj) {
        return request({
            url: `${api_name}/${page}/${limit}/${category}`,
            method: 'get',
            params: searchObj // url查询字符串或表单键值对
        })
    },
    getById(id) {
        return request({
          url: `${api_name}/get/${id}`,
          method: 'get'
        })
    },

    save(role) {
      return request({
        url: `${api_name}/save`,
        method: 'post',
        data: role
      })
    },

    updateById(role) {
      return request({
        url: `${api_name}/update`,
        method: 'put',
        data: role
      })
    },
    getAssign(roleId){
      return request({
        url: `${api_name}/toAssign/${roleId}`,
        method: 'get'
      })
    },
    removeById(id){
      return request({
        url: `${api_name}/remove/${id}`,
        method: 'delete'
      })
    },
    removeRows(idList){
      return request({
        url: `${api_name}/batchRemove`,
        method: 'delete',
        data:idList
      })
    },
    changeEnable(id) {
      return request ({
        url: `${api_name}/changeStatus/${id}`,
        method: 'get',
      })
    },
    getRoleListByCompanyId(companyId) {
      return request ({
        url: `${api_name}/getRolesByCompanyId`,
        method: 'get',
        params:{companyId: companyId}
      })
    },
    saveRoleCapacity(roleCapacity) {
      return request ({
        url: `${api_name}/saveRoleCapacity`,
        method: 'post',
        data: roleCapacity
      })
    },
    selectRoleCapacity(roleId) {
      return request ({
        url: `${api_name}/selectRoleCapacity/${roleId}`,
        method: 'get'
      })
    },
    updateRoleCapacity(roleCapacity) {
      return request ({
        url: `${api_name}/updateRoleCapacity`,
        method: 'post',
        data: roleCapacity
      })
    },
  // updateRoleCapacity(roleCapacity) {
  //   return request ({
  //     url: `${api_name}/updateRoleCapacity`,
  //     method: 'post',
  //     data: roleCapacity
  //   })
  // }
}
